package kr.hyunist.musicplayexer;

import android.app.Activity;
import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.View;
import android.widget.TextView;

public class IntroActivity extends Activity {
	VisibilityHandler visibilityHandler;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.introactivity);

		TextView loading = (TextView)findViewById(R.id.introtitle);
		visibilityHandler = new VisibilityHandler();
		visibilityHandler.setView(loading);
		visibilityHandler.sendEmptyMessage(0);
		
		Handler handler = new Handler();
		handler.postDelayed(new Runnable() {
            @Override
            public void run() {
                finish();      
            }
        }, 2000);

	}
	
	@Override
	protected void onDestroy() {
		super.onDestroy();
		visibilityHandler = null;
	}
	
	class VisibilityHandler extends Handler {

		View view;

		public void setView(View view) {
			this.view = view;
		}

		@Override
		public void handleMessage(Message msg) {
			super.handleMessage(msg);
			if (view.getVisibility() == View.VISIBLE) {
				view.setVisibility(View.INVISIBLE);
			} else {
				view.setVisibility(View.VISIBLE);
			}
			this.sendEmptyMessageDelayed(0, 500);
		}

	}
}
